package component;

import java.util.List;

public class Book {
	private int id;
	private String name;
	private double price;
	private List<String> versions;//版本号的历史记录
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public Book() {
	}
	public Book(int id) {
		System.out.println("Book(int id)");
		this.id = id;
	}
//	先调用的是此方法，配置文件中的默认是字符，spring根据构造方法的参数类型用反射将字符转成了数字
//	public Book(String id) {
//		System.out.println("Book(String id)");
//		this.id = Integer.parseInt(id);
//	}
//	用此方法时，id的构造器将不被调用
	public Book(String name) {
		System.out.println("Book(String name)");
		this.name = name;
	}
	public Book(int id, String name) {
		this.id = id;
		this.name = name;
	}
	public List<String> getVersions() {
		return versions;
	}
	public void setVersions(List<String> versions) {
		this.versions = versions;
	}
	
}
